package com.hxd.otc.module.wallet.bean;

import android.text.TextUtils;

import com.hxd.otc.R;

import java.io.Serializable;

/**
 * 作  者 :  卫广玉
 * 时  间 :  2018/6/19 10:20
 * 描  述 :  换币的交易详情
 */
public class WalletCoinRateVoBean implements Serializable {
    /**
     * isUse (integer, optional): 行情是否用，0.可用，1.不可用 ,
     * quotation (number, optional): 行情 ,
     * transactionPair (string, optional): 交易对
     */
    private int isUse;
    private double quotation;
    private String transactionPair;

    //本地配置
    private boolean selected;
    private String content;

    public int getIsUse() {
        return isUse;
    }

    public void setIsUse(int isUse) {
        this.isUse = isUse;
    }

    public double getQuotation() {
        return quotation;
    }

    public void setQuotation(double quotation) {
        this.quotation = quotation;
    }

    public String getTransactionPair() {
        return transactionPair;
    }

    public void setTransactionPair(String transactionPair) {
        this.transactionPair = transactionPair;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getResId() {
        if (TextUtils.isEmpty(transactionPair)) return R.mipmap.icon_currency_converter_china;

        switch (transactionPair) {
            case "EUR/CNY":
                return R.mipmap.icon_currency_converter_eu;
            case "USD/CNY":
                return R.mipmap.icon_currency_converter_usd;
            case "HKD/CNY":
                return R.mipmap.icon_currency_converter_hk;
            case "TWD/CNY":
                return R.mipmap.icon_currency_converter_twd;
            default:
                return R.mipmap.icon_currency_converter_china;
        }
    }

    public int getCurrencyText() {
        if (TextUtils.isEmpty(transactionPair)) return R.string.currency_converter_cny;

        switch (transactionPair) {
            case "EUR/CNY":
                return R.string.currency_converter_eur;
            case "USD/CNY":
                return R.string.currency_converter_usd;
            case "HKD/CNY":
                return R.string.currency_converter_hk;
            case "TWD/CNY":
                return R.string.currency_converter_twd;
            default:
                return R.string.currency_converter_cny;
        }
    }

    public int getTitle() {
        if (TextUtils.isEmpty(transactionPair)) return R.string.CNY;

        switch (transactionPair) {
            case "EUR/CNY":
                return R.string.eur;
            case "USD/CNY":
                return R.string.usd;
            case "HKD/CNY":
                return R.string.hkd;
            case "TWD/CNY":
                return R.string.twd;
            default:
                return R.string.CNY;
        }
    }

    public String getTransCoinType() {
        if (TextUtils.isEmpty(transactionPair)) return "";
        if (!transactionPair.contains("/")) return "";
        return transactionPair.split("/")[0];
    }


    @Override
    public String toString() {
        return "WalletCoinRateVoBean{" +
                "isUse=" + isUse +
                ", quotation=" + quotation +
                ", transactionPair='" + transactionPair + '\'' +
                ", selected=" + selected +
                ", content='" + content + '\'' +
                '}';
    }
}
